package ru.gosoplata.service 
{
	import flash.external.ExternalInterface;
	import ru.gosoplata.model.Cookie;
	import ru.gosoplata.model.TmpModel;
	/**
	 * ...
	 * @author 
	 */
	public class CookieService 
	{
		public function readCookie():Cookie
		{
			if (!ExternalInterface.available) return new Cookie();
			
			var cookie:Cookie = new Cookie(String(ExternalInterface.call("function (){return document.cookie;}")));
			return cookie;
		}
		
		public function writeCookie(cookie:Cookie):void
		{
			if (!ExternalInterface.available) return;
			ExternalInterface.call("function(){document.cookie='_operation_ID=" + TmpModel.payment.operation + ";path=/';}");
			
			TmpModel.debugOutput.add("CookieService writeCookie:"+String(ExternalInterface.call("function (){return document.cookie;}")));
		}
	}
}